package com.zhss.concurrency;

import com.sun.tools.javac.util.List;

import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @ClassName ConcurrentLinkedQueueDemo
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/7/12 13:40
 * @Version 1.0
 */
public class ConcurrentLinkedQueueDemo {
	public static void main(String[] args) {
		final ConcurrentLinkedQueue<String> linkedQueue = new ConcurrentLinkedQueue<>();


		linkedQueue.offer("张三");
		linkedQueue.offer("李四");
		linkedQueue.offer("王五");

		//出队
		System.out.println(linkedQueue.poll());
		System.out.println(linkedQueue.poll());
		System.out.println(linkedQueue.poll());

		// 查看头节点
		System.out.println(linkedQueue.peek());

		//迭代
		final Iterator<String> iterator = linkedQueue.iterator();
		while (iterator.hasNext()) {
			System.out.println(iterator.next());
		}

		linkedQueue.size();

		int i=255;
		System.out.println(Integer.toBinaryString(i));


		final List<String> list = List.of("1", "2", "3", "1");
		list.stream().collect(Collectors.toMap(Function.identity(), Function.identity()));
//		list.stream().collect(Collectors.groupingBy(Function.identity()));
	}
}
class A{
	private String name;
	private String age;
}
